package com.eascs.webService;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import javax.sql.DataSource;

import com.eascs.admin.common.config.AppConfig;

/**
* @author bao.pan 2016年9月19日 下午3:23:23
*/
public class BackDepositDao extends AppConfig{
	public String  BackDepositCheck(String billcode){
		Connection conn = null;
		PreparedStatement pstm = null;
		ResultSet rset = null;
		String rseta="";
		  DataSource ds=this.o2oDataSource();
		  try {
			  String sql = "SELECT count(*) as num from o2o_loanapply_expand e where e.transfer_num ='"+billcode+"' and e.bill_status<>'CLO'";
			   conn=ds.getConnection();
			   pstm = conn.prepareStatement(sql);
				rset = pstm.executeQuery();
				while (rset.next()) {
					rseta=rset.getString("num");
				}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			try {
				if (pstm != null)
					pstm.close();
			} catch (SQLException e1) {
			}

			try {
				if (rset != null)
					rset.close();
			} catch (SQLException e1) {
			}
			try {
				if (null != conn) {
					conn.close();
				}
			} catch (SQLException e1) {

			}
		}	
		return rseta;
	}
}
